﻿
@{
    Layout = null;
}

<!doctype html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>OA系统后台登录</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" href="~/css/font.css">
    <link rel="stylesheet" href="~/css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script src="~/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="~/js/xadmin.js"></script>
    <script type="text/javascript" src="~/js/cookie.js"></script>
    <link href="~/element-ui/element-ui/theme-chalk/index.css" rel="stylesheet" />
    <script src="~/js/vue.js"></script>
    <script src="~/element-ui/element-ui/element.js"></script>
    <script src="~/js/axios.min.js"></script>
</head>
<body class="login-bg">

    <div id="div" class="login layui-anim layui-anim-up">
        <div class="message">OA系统管理登录</div>
        <div id="darkbannerwrap"></div>
        <br /><br /><br />
        <el-form  :rules="rules" :model="ruleForm" ref="ruleForm" label-width="70px" >
            <el-form-item label="账号：" prop="user">
                <el-input v-model="ruleForm.user" auto-complete="true"></el-input>
            </el-form-item>
            <el-form-item label="密码："  prop="pass">
                <el-input type="password" v-model="ruleForm.pass" auto-complete="true"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" style="width: 100px;background-color: #189F92" @@click="submitForm('ruleForm')">登录</el-button>
                <el-button  @@click="resetForm('ruleForm')" style="width:100px">重置</el-button>
            </el-form-item>
        </el-form>
    </div>

    <script>
        
            vm = new Vue({
                el: "#div",
                data: {
                    msg: null,
                    ruleForm: {
                        pass: '',
                        user: '',
                        
                    },
                    rules: {
                        pass: [{
                            required: true,//
                            message: "密码不能为空",//
                            trigger:"blur"//
                        },
                            {min:6, max:11,message:"6-11",}
                        ],
                        user: [{
                            required: true,//
                            message: "用户名不能为空",//
                            trigger: "blur"//
                        },
                        ]
                    }
                },
                methods: {
                    submitForm(ruleForm) {
                        
                        this.$refs[ruleForm].validate((valid) => {
                            if (valid) {
                                
                                axios.post('/User/Loginl', { "username": this.ruleForm.user, "password": this.ruleForm.pass }).then(res => {
                                    alert(res.data)
                                    if (res.data!=null)
                                    {

                                        sessionStorage.setItem("name",res.data)
                                        window.location.href ="/User/Index"
                                    } else {
                                        console.log("登录失败")
                                    }
                                })
                            } else {
                                console.log('error submit!!');
                                return false;
                            }

                        })
                     },
                    resetForm(formName) {
                        this.$refs[formName].resetFields();
                    }

                },
                created() {
                   

                }
            });
    </script>


    <!-- 底部结束 -->
    <script>
        //百度统计可去掉
        var _hmt = _hmt || [];
        (function () {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();
    </script>
</body>
</html>
